home *** CD-ROM | disk | FTP | other *** search
/ TestDrive Windows 1993 Fall / TestDrive Windows 1993 Fall.iso / dbase / samples / dochisel.prg < prev    next >
Encoding:
Text File  |  1993-03-09  |  4.0 KB  |  136 lines

  1. PROCEDURE DoChisel
  2. *---------------------------------------------------------------------
  3. * DESCRIPTION
  4. *   Display two chiseled message boxes.  The first one is bright
  5. *   white text with a gray background.  The second one is yellow
  6. *   text on a cyan background.
  7. *---------------------------------------------------------------------
  8.   SET COLOR TO N/W
  9.   SET TALK OFF
  10.   SET STATUS OFF
  11.  
  12.   DO TestChis WITH .F., "W+", "W"
  13.   DO TestChis WITH .F., "RG+", "BG"
  14.  
  15. RETURN
  16. *-- EOP: DoChisel
  17.  
  18.  
  19. PROCEDURE TestChis
  20. PARAMETER pl_in, pc_fore, pc_back
  21. *---------------------------------------------------------------------
  22. * DESCRIPTION
  23. *   Displays one chisel box inside of another for a bold chisel
  24. *   effect.  Then display a message inside of the inner box.
  25. *---------------------------------------------------------------------
  26.  
  27.   SAVE SCREEN TO Temp
  28.  
  29.   *-- Display the outer chisel window with a shadow behind it.
  30.   DO Chisel WITH "Win2",4,13,10,67,pc_fore,pc_back,pl_in, .T.
  31.  
  32.   *-- Display the inner chisel window without a shadow
  33.   DO Chisel WITH "Win1",5,15,9,65,pc_fore,pc_back,.NOT. pl_in, .f.
  34.  
  35.   @ 2, 12 SAY "Out to lunch!  Back at 1pm"
  36.   ACTIVATE SCREEN
  37.   WAIT
  38.  
  39.   RELEASE WINDOW Win2
  40.   RELEASE WINDOW Win1
  41.  
  42.   RESTORE SCREEN FROM Temp
  43.   RELEASE SCREEN Temp
  44. RETURN
  45. *-- EOP: TestChis
  46.  
  47.  
  48. PROCEDURE Chisel
  49. PARAMETERS pc_WinName, pn_TopRow, pn_LeftCol, pn_BotRow, pn_RtCol, ;
  50.            pc_ClrFore, pc_ClrBack, pl_Indent, pl_Shadow
  51. *---------------------------------------------------------------------
  52. * DESCRIPTION
  53. *   Creates a chisel window with or without a shadow background
  54. *
  55. * PARAMETERS
  56. *   pc_WinName  = Name of the window that will contain the chisel.
  57. *                 The calling program must release it when done.
  58. *   pn_TopRow   = Top row for the window
  59. *   pn_LeftCol  = Left column for the window
  60. *   pn_BotRow   = Bottom row for the window
  61. *   pn_RtCol    = Right column for the window
  62. *   pc_ClrFore  = Foreground color for the interior text
  63. *   pc_ClrBack  = Background color for the window
  64. *   pl_Indent   = .T. for a chisel in effect, .F. for chisel out
  65. *   pl_Shadow   = .T. for a shadow effect behind the window.
  66. *---------------------------------------------------------------------
  67.  
  68.   DEFINE WINDOW &pc_WinName FROM pn_TopRow, pn_LeftCol TO pn_BotRow, pn_RtCol ;
  69.          NONE ;
  70.          COLOR &pc_ClrFore./&pc_ClrBack.
  71.  
  72.   IF pl_Shadow
  73.     DO ShadowG WITH pn_TopRow, pn_LeftCol, pn_BotRow, pn_RtCol
  74.   ENDIF
  75.  
  76.   ACTIVATE WINDOW &pc_WinName
  77.  
  78.   IF pl_Indent
  79.     pc_ClrUp = "N"
  80.     pc_ClrDn = "W+"
  81.   ELSE
  82.     pc_ClrUp = "W+"
  83.     pc_ClrDn = "N"
  84.   ENDIF
  85.   ln_wide = pn_RtCol  - pn_LeftCol
  86.   ln_high = pn_BotRow - pn_TopRow
  87.  
  88.   @ 0,0 SAY CHR( 218 ) ;
  89.             COLOR &pc_ClrUp./&pc_ClrBack.
  90.   @ 0,1 SAY REPLICATE( CHR( 196 ), ln_Wide - 1 ) ;
  91.             COLOR &pc_ClrUp./&pc_ClrBack.
  92.   @ ln_High, 0 SAY CHR( 192 ) ;
  93.             COLOR &pc_ClrUp./&pc_ClrBack.
  94.   @ 1,0 TO ln_High - 1, 0 ;
  95.             COLOR &pc_ClrUp./&pc_ClrBack.
  96.  
  97.   @ 0, ln_Wide SAY CHR( 191 ) ;
  98.             COLOR &pc_ClrDn./&pc_ClrBack.
  99.   @ ln_High, 1 SAY REPLICATE( CHR( 196 ), ln_Wide - 1 ) ;
  100.             COLOR &pc_ClrDn./&pc_ClrBack.
  101.   @ ln_High, ln_Wide SAY CHR( 217 ) ;
  102.             COLOR &pc_ClrDn./&pc_ClrBack.
  103.   @ 1,ln_wide TO ln_High - 1, ln_Wide ;
  104.             COLOR &pc_ClrDn./&pc_ClrBack.
  105.  
  106. RETURN
  107. *-- EOP: Chisel
  108.  
  109.  
  110. PROCEDURE Shadowg                      && displays shadow that grows
  111. PARAMETER x1,y1,x2,y2
  112. *---------------------------------------------------------------------
  113. * DESCRIPTION
  114. *   Display a shadow effect behind a window.  ShadowG uses the
  115. *   same coordinates as the window and computes the display offset.
  116. *---------------------------------------------------------------------
  117.  
  118.   PRIVATE   x1,y1,x2,y2
  119.  
  120.   x0 = x2+1
  121.   y0 = y2+2
  122.   dx = 1
  123.   dy = (y2-y1) / (x2-x1)
  124.   DO WHILE x0 <> x1 .OR. y0 <> y1+2
  125.     @ x0,y0 FILL TO x2+1,y2+2 COLOR n+/n
  126.     x0 = IIF(x0<>x1,x0 - dx,x0)
  127.     y0 = IIF(y0<>y1+2,y0 - dy,y0)
  128.     y0 = IIF(y0<y1+2,y1+2,y0)
  129.   ENDDO
  130. RETURN
  131. *-- EOP: Shadowg
  132.  
  133.  
  134.  
  135.  
  136.